Method and System for Migrating Data Between Flash Memory Devices

ABSTRACT

The embodiments described herein include systems, methods and/or devices that may enhance the endurance of a storage system including a storage medium. The method includes: dividing a plurality of flash memory devices into logical chunks each logical chunk including one or more flash memory blocks; and detecting a trigger condition with respect to a respective flash memory device of the plurality of flash memory devices. In response to detecting the trigger condition, the method includes: selecting one of the logical chunks of the respective flash memory device for migration in accordance with predefined selection criteria; and storing a replicated logical chunk, comprising a copy of the selected logical chunk, at a second flash memory device. The method includes: remapping an address of the selected logical chunk to a physical location of the replicated logical chunk; and decreasing a number of logical chunks associated with the respective flash memory device.

RELATED APPLICATIONS

This application claims priority to U.S. Provisional Patent Application No. 61/873,324, filed Sep. 3, 2013, which is hereby incorporated by reference in its entirety.

TECHNICAL FIELD

The disclosed embodiments relate generally to memory systems, and in particular, to improving the endurance of a storage system including a storage medium (e.g., comprising one or more flash memory devices).

BACKGROUND

Semiconductor memory devices, including flash memory, typically utilize memory cells to store data as an electrical value, such as an electrical charge or voltage. A flash memory cell, for example, includes a single transistor with a floating gate that is used to store a charge representative of a data value. Increases in storage density have been facilitated in various ways, including increasing the density of memory cells on a chip enabled by manufacturing developments, and transitioning from single-level flash memory cells to multi-level flash memory cells, so that two or more bits can be stored by each flash memory cell.

In some cases, when an error condition for a flash memory device is detected (e.g., an unrecoverable codeword is read from the flash memory device, the computational resources required to recover a codeword exceed a predefined threshold, or a count of program-erase (PE) cycles for the flash memory device exceeds a threshold value), the entire flash memory device is considered to have failed. In turn, all data stored on the flash memory device must be replicated and stored on a different flash memory device. This whole-device replication discards any remaining life or value associated with still-working portions of the device that is considered to have failed, consumes resources, and places undue strain on remaining flash memory devices.

SUMMARY

In some embodiments, a storage controller is configured to divide a plurality of flash memory devices into a plurality of logical chunks. After detecting a predefined trigger condition as to a respective flash memory device of the plurality of flash memory devices, the storage controller is configured to initiate a migration process whereby at least one logical chunk on the respective flash memory device is migrated to a second flash memory device different from the respective flash memory device. As such, logical chunks are migrated off of a flash memory device as trigger conditions are detected as to the flash memory device thereby slowly phasing out the flash memory device instead of the entire flash memory device failing and consequently replicated at once.

BRIEF DESCRIPTION OF THE DRAWINGS

So that the present disclosure can be understood in greater detail, a more particular description may be had by reference to the features of various embodiments, some of which are illustrated in the appended drawings. The appended drawings, however, merely illustrate the more pertinent features of the present disclosure and are therefore not to be considered limiting, for the description may admit to other effective features.

FIG. 1 is a block diagram illustrating an implementation of a data storage system in accordance with some embodiments.

FIG. 2A is a block diagram illustrating an implementation of a management module in accordance with some embodiments.

FIG. 2B is a diagram illustrating a characterization vector table included in FIG. 2A in accordance with some embodiments.

FIG. 2C is a diagram illustrating a characterization vector included in FIG. 2B in accordance with some embodiments.

FIGS. 3A-3C are block diagrams of a storage medium divided into a plurality of logical chunks in accordance with some embodiments.

FIG. 4A is a block diagram of a storage medium divided into a plurality of logical chunks in accordance with some embodiments.

FIG. 4B is a diagram of an indirection table corresponding to the plurality of logical chunks in FIG. 4A in accordance with some embodiments.

FIG. 4C is a block diagram of a storage medium divided into a plurality of logical chunks in accordance with some embodiments.

FIG. 4D is a diagram of an indirection table corresponding to the plurality of logical chunks in FIG. 4C in accordance with some embodiments.

FIGS. 5-7 illustrate flowchart representations of methods of triggering a migration process in accordance with some embodiments.

FIGS. 8A-8C illustrate a flowchart representation of a method of managing a storage system in accordance with some embodiments.

In accordance with common practice the various features illustrated in the drawings may not be drawn to scale. Accordingly, the dimensions of the various features may be arbitrarily expanded or reduced for clarity. In addition, some of the drawings may not depict all of the components of a given system, method, or device. Finally, like reference numerals may be used to denote like features throughout the specification and figures.

DETAILED DESCRIPTION

The various embodiments described herein include devices and/or methods that may improve the endurance of a storage system including a storage medium (e.g., comprising one or more flash memory devices). Some embodiments include methods and/or systems for managing a storage system by migrating data between flash memory devices of the storage system.

More specifically, some embodiments include a method of managing a storage system that comprises a storage controller and a plurality of flash memory devices each with a plurality of flash memory blocks. In some embodiments, the method is performed at the storage controller. The method includes: dividing each of the plurality of flash memory devices into a plurality of logical chunks, where each logical chunk includes one or more flash memory blocks; and detecting a predefined trigger condition with respect to a respective flash memory device of the plurality of flash memory devices. In response to detecting the predefined trigger condition, the method includes: selecting one of the plurality of logical chunks of the respective flash memory device for migration in accordance with predefined selection criteria; and storing a replicated logical chunk, comprising a copy of the selected logical chunk, at a second flash memory device different from the respective flash memory device. The method further includes: remapping an address of the selected logical chunk to a physical location of the replicated logical chunk; and decreasing a number of logical chunks associated with the respective flash memory device.

Some embodiments include a storage controller comprising: one or more processors; a host interface configured to couple the storage controller to a host; a storage medium interface configured to couple the storage controller to a storage medium including a plurality of flash memory devices, each with a plurality of flash memory blocks; and a storage controller storing instructions, which when executed by the one or more processors, cause the storage controller to perform the operations of any of the methods described herein.

Some embodiments include a non-transitory computer readable storage medium, storing one or more programs for execution by one or more processors of a storage controller coupled to a storage medium including a plurality of flash memory devices, where each flash memory device includes a plurality of flash memory blocks, the one or more programs including instructions that when executed by the one or more processors cause the storage controller to perform the operations of any of the methods described herein.

Numerous details are described herein in order to provide a thorough understanding of the example embodiments illustrated in the accompanying drawings. However, some embodiments may be practiced without many of the specific details, and the scope of the claims is only limited by those features and aspects specifically recited in the claims. Furthermore, well-known methods, components, and circuits have not been described in exhaustive detail so as not to unnecessarily obscure more pertinent aspects of the embodiments described herein.

FIG. 1 is a diagram of an implementation of a data storage system 100, in accordance with some embodiments. While some example features are illustrated, various other features have not been illustrated for the sake of brevity and so as not to obscure more pertinent aspects of the example embodiments disclosed herein. To that end, as a non-limiting example, data storage system 100 includes a storage controller 120, and a storage medium 130, and is used in conjunction with a computer system 110. In some embodiments, storage medium 130 is a single flash memory device while in other embodiments storage medium 130 includes a plurality of flash memory devices. In some embodiments, storage medium 130 is NAND-type flash memory or NOR-type flash memory. Further, in some embodiments, storage controller 120 is a solid-state drive (SSD) controller. However, other types of storage media may be included in accordance with aspects of a wide variety of embodiments (e.g., PCRAM, ReRAM, STT-RAM, etc.). In some embodiments, a flash memory device includes one or more flash memory die, one or more flash memory packages, one or more flash memory channels, one or more SSDs, one or more SSD arrays, or the like.

Computer system 110 is coupled to storage controller 120 through data connections 101. However, in some embodiments computer system 110 includes storage controller 120 as a component and/or a sub-system. For example, some or all of the functionality of storage controller 120 is implemented by software executed on computer system 110. Computer system 110 may be any suitable computer device, such as a computer, a laptop computer, a tablet device, a netbook, an internet kiosk, a personal digital assistant, a mobile phone, a smart phone, a gaming device, a computer server, or any other computing device. Computer system 110 is sometimes called a host or host system. In some embodiments, computer system 110 includes one or more processors, one or more types of memory, a display and/or other user interface components such as a keyboard, a touch screen display, a mouse, a track-pad, a digital camera and/or any number of supplemental devices to add functionality.

Storage medium 130 is coupled to storage controller 120 through connections 103. Connections 103 are sometimes called data connections, but typically convey commands in addition to data, and optionally convey metadata, error correction information and/or other information in addition to data values to be stored in storage medium 130 and data values read from storage medium 130. In some embodiments, however, storage controller 120 and storage medium 130 are included in the same device as components thereof. Furthermore, in some implementations memory controller 120 and storage medium 130 are embedded in a host device, such as a mobile device, tablet, other computer or computer controlled device, and the methods described herein are performed by the embedded memory controller. Storage medium 130 may include any number (i.e., one or more) of memory devices including, without limitation, non-volatile semiconductor memory devices, such as flash memory. For example, flash memory devices can be configured for enterprise storage suitable for applications such as cloud computing, for database applications, primary and/or secondary storage, or for caching data stored (or to be stored) in secondary storage, such as hard disk drives. Additionally and/or alternatively, flash memory can also be configured for relatively smaller-scale applications such as personal flash drives or hard-disk replacements for personal, laptop, and tablet computers.

Storage medium 130 is divided into a number of addressable and individually selectable blocks, such as selectable portion 131. In some embodiments, the individually selectable blocks are the minimum size erasable units in a flash memory device. In other words, each block contains the minimum number of memory cells that can be erased simultaneously. Each block is usually further divided into a plurality of pages and/or word lines, where each page or word line is typically an instance of the smallest individually accessible (readable) portion in a block. In some embodiments (e.g., using some types of flash memory), the smallest individually accessible unit of a data set, however, is a sector, which is a subunit of a page. That is, a block includes a plurality of pages, each page contains a plurality of sectors, and each sector is the minimum unit of data for reading data from the flash memory device.

For example, one block comprises any number of pages, for example, 64 pages, 128 pages, 256 pages or another suitable number of pages. Blocks are typically grouped into a plurality of zones. Each block zone can be independently managed to some extent, which increases the degree of parallelism for parallel operations and simplifies management of storage medium 130.

As noted above, while data storage densities of non-volatile semiconductor memory devices are generally increasing, a drawback of increasing storage density is that the stored data is more prone to being stored and/or read erroneously. As described in greater detail below, error control coding can be utilized to limit the number of uncorrectable errors that are introduced by electrical fluctuations, defects in the storage medium, operating conditions, device history, write-read circuitry, etc., or a combination of these and various other factors.

In some embodiments, storage controller 120 includes a management module 121, an input buffer 123, an output buffer 124, an error control module 125 and a storage medium interface (I/O) 128. Storage controller 120 may include various additional features that have not been illustrated for the sake of brevity and so as not to obscure more pertinent features of the example embodiments disclosed herein, and that a different arrangement of features may be possible. Input and output buffers 123, 124 provide an interface to computer system 110 through data connections 101. Similarly, storage medium I/O 128 provides an interface to storage medium 130 though connections 103. In some embodiments, storage medium I/O 128 includes read and write circuitry, including circuitry capable of providing reading signals to storage medium 130 (e.g., reading threshold voltages for NAND-type flash memory).

In some embodiments, management module 121 includes one or more processing units (CPUs, also sometimes called processors) 122 configured to execute instructions in one or more programs (e.g., in management module 121). In some embodiments, one or more CPUs 122 are shared by one or more components within, and in some cases, beyond the function of storage controller 120. Management module 121 is coupled to input buffer 123, output buffer 124 (connection not shown), error control module 125 and storage medium I/O 128 in order to coordinate the operation of these components.

Error control module 125 is coupled to storage medium I/O 128, input buffer 123 and output buffer 124. Error control module 125 is provided to limit the number of uncorrectable errors inadvertently introduced into data. In some embodiments, error control module 125 is executed in software by the one or more CPUs 122 of management module 121, and, in other embodiments, error control module 125 is implemented in whole or in part using special purpose circuitry to perform encoding and decoding functions. In some embodiments, error control module 125 is implemented in whole or in part by software executed on computer system 110. To that end, error control module 125 includes an encoder 126 and a decoder 127. Encoder 126 encodes data by applying an error control code to produce a codeword, which is subsequently stored in storage medium 130.

When the encoded data (e.g., one or more codewords) is read from storage medium 130, decoder 127 applies a decoding process to the encoded data to recover the data, and to correct errors in the recovered data within the error correcting capability of the error control code. Those skilled in the art will appreciate that various error control codes have different error detection and correction capacities, and that particular codes are selected for various applications for reasons beyond the scope of this disclosure. As such, an exhaustive review of the various types of error control codes is not provided herein. Moreover, those skilled in the art will appreciate that each type or family of error control codes may have encoding and decoding algorithms that are particular to the type or family of error control codes. On the other hand, some algorithms may be utilized at least to some extent in the decoding of a number of different types or families of error control codes. As such, for the sake of brevity, an exhaustive description of the various types of encoding and decoding algorithms generally available and known to those skilled in the art is not provided herein.

During a write operation, input buffer 123 receives data to be stored in storage medium 130 from computer system 110. The data held in input buffer 123 is made available to encoder 126, which encodes the data to produce one or more codewords. The one or more codewords are made available to storage medium I/O 128, which transfers the one or more codewords to storage medium 130 in a manner dependent on the type of storage medium being utilized.

A read operation is initiated when computer system (host) 110 sends one or more host read commands (e.g., via data connections 101) to storage controller 120 requesting data from storage medium 130. Storage controller 120 sends one or more read access commands to storage medium 130, via storage medium I/O 128, to obtain raw read data in accordance with memory locations (addresses) specified by the one or more host read commands. Storage medium I/O 128 provides the raw read data (e.g., comprising one or more codewords) to decoder 127. If the decoding is successful, the decoded data is provided to output buffer 124, where the decoded data is made available to computer system 110. In some embodiments, if the decoding is not successful, storage controller 120 may resort to a number of remedial actions or provide an indication of an irresolvable error condition.

Flash memory devices utilize memory cells to store data as electrical values, such as electrical charges or voltages. Each flash memory cell typically includes a single transistor with a floating gate that is used to store a charge, which modifies the threshold voltage of the transistor (i.e., the voltage needed to turn the transistor on). The magnitude of the charge, and the corresponding threshold voltage the charge creates, is used to represent one or more data values. In some embodiments, during a read operation, a reading threshold voltage is applied to the control gate of the transistor and the resulting sensed current or voltage is mapped to a data value.

The terms “cell voltage” and “memory cell voltage,” in the context of flash memory cells, means the threshold voltage of the memory cell, which is the minimum voltage that needs to be applied to the gate of the memory cell's transistor in order for the transistor to conduct current. Similarly, reading threshold voltages (sometimes also called reading signals and reading voltages) applied to a flash memory cells are gate voltages applied to the gates of the flash memory cells to determine whether the memory cells conduct current at that gate voltage. In some embodiments, when a flash memory cell's transistor conducts current at a given reading threshold voltage, indicating that the cell voltage is less than the reading threshold voltage, the raw data value for that read operation is a “1” and otherwise the raw data value is a “0.”

FIG. 2A is a block diagram illustrating an exemplary management module 121 in accordance with some embodiments. Management module 121 typically includes: one or more processing units (CPUs) 122 for executing modules, programs and/or instructions stored in memory 202 and thereby performing processing operations; memory 202; and one or more communication buses 204 for interconnecting these components. One or more communication buses 204, optionally, include circuitry (sometimes called a chipset) that interconnects and controls communications between system components. Management module 121 is coupled to buffer 123, buffer 124, error control module 125, and storage medium I/O 128 by one or more communication buses 204. Memory 202 includes high-speed random access memory, such as DRAM, SRAM, DDR RAM or other random access solid state memory devices, and may include non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Memory 202, optionally, includes one or more storage devices remotely located from the CPU(s) 122. Memory 202, or alternatively the non-volatile memory device(s) within memory 202, comprises a non-transitory computer readable storage medium. In some embodiments, memory 202, or the non-transitory computer readable storage medium of memory 202, stores the following programs, modules, and data structures, or a subset or superset thereof:

-   -   a data read module 206 for reading data from storage medium 130         comprising a plurality of flash memory devices;     -   a data write module 208 for writing data to storage medium 130;     -   a data erase module 210 for erasing data from storage medium         130;     -   a logical chunk management module 212 for dividing each of the         plurality of flash memory devices into a plurality of logical         chunks, including:         -   a redundancy module 214 for arranging the plurality of             logical chunks into redundancy sets, including an             indirection table 216 for maintaining the location (or             physical address) of each logical chunk comprising a             redundancy set;         -   a mapping module 218 for mapping a logical address (or a set             of logical addresses) for each of the logical chunks to a             physical address (or a set of physical addresses), including             a logical to physical mapping 220 associating logical             addresses with physical addresses for the plurality of             logical chunks;         -   a trigger condition detection module 222 for detecting a             trigger condition as to a respective flash memory device of             the plurality of flash memory devices;         -   a migration module 224 for performing a migration process,             including:             -   a selection module 226 for selecting a logical chunk to                 be replicated; and             -   a storing module 228 for storing a replicated logical                 chunk, comprising a copy of the selected logical chunk;         -   a re-encoding module 230 for re-encoding data in a logical             chunk with a higher level of error correction protection;             and     -   a characterization vector table 234 that includes a collection         of characterization vectors 236 each storing characterization         data for a respective portion of storage medium 130 (e.g., a         flash memory device, die, block zone, block, word line, word         line zone or page portion of storage medium 130).

Each of the above identified elements may be stored in one or more of the previously mentioned memory devices, and corresponds to a set of instructions for performing a function described above. The above identified modules or programs (i.e., sets of instructions) need not be implemented as separate software programs, procedures or modules, and thus various subsets of these modules may be combined or otherwise re-arranged in various embodiments. In some embodiments, memory 202 may store a subset of the modules and data structures identified above. Furthermore, memory 202 may store additional modules and data structures not described above. In some embodiments, the programs, modules, and data structures stored in memory 202, or the non-transitory computer readable storage medium of memory 202, provide instructions for implementing any of the methods described below with reference to FIGS. 8A-8C. In some embodiments, some or all of these modules may be implemented with specialized hardware circuits that subsume part or all of the module functionality.

Although FIG. 2A shows a management module 121, FIG. 2A is intended more as functional description of the various features which may be present in a management module than as a structural schematic of the embodiments described herein. In practice, and as recognized by those of ordinary skill in the art, the programs, modules, and data structures shown separately could be combined and some programs, modules, and data structures could be separated.

FIG. 2B is a block diagram illustrating an implementation of a characterization vector table 234 in accordance with some embodiments. Characterization vector table 234 includes a collection of characterization vectors 236, that each store characterization data associated with a respective portion of a storage medium 130 (e.g., a distinct device, die, block zone, block, word line, word line zone or page portion of storage medium 130). In some embodiments, each vector (e.g., vector 236-1, vector 236-2, . . . , vector 236-n) in the collection of characterization vectors 236 stores characterization data derived during each of at least two time periods (e.g., time T-1 and time T-2, or Xprogram-erase (PE) cycles and 2×PE cycles). In some embodiments, the characterization data stored in the characterization vectors 236 is statistically derived. For example, without limitation, in some embodiments in which a storage medium (e.g., storage medium 130, FIG. 1) includes a plurality of flash memory devices characterization vector table 234 includes at least one characterization vector for each distinct flash memory device. In another example, in some embodiments, characterization vector table 234 includes a set of distinct characterization vectors 236 for each flash memory device in storage medium 130, and the set of distinct characterization vectors 236 for each flash memory device includes at least one distinct characterization vector for each flash memory die in the flash memory device. More detailed example embodiments of characterization vectors 236 are described below with reference to FIG. 2C.

FIG. 2C is a schematic diagram of an implementation of a characterization vector 240 (e.g., corresponding to one of characterization vectors 236 shown in FIG. 2B) for a respective flash memory device of the plurality of flash memory devices in accordance with some embodiments. In some embodiments, characterization data stored in characterization vector 240 for the respective flash memory device includes storage medium characterization parameter values such as a failed block counter field 242 indicating a number of failed flash memory blocks for the respective flash memory device, a program-erase (PE) cycles field 244 indicating a current count of the number of PE cycles performed on the respective flash memory device, and a reading threshold voltage field 246 with one or more reading threshold voltages for the respective flash memory device. In some embodiments, the one or more storage medium characterization parameter values provide an indication of at least one of: a physical characteristic associated with the respective portion the storage medium (e.g., a distinct flash memory device, die, block zone, block, word line, word line zone or page portion of storage medium 130), a mode of operation associated with the respective portion of the storage medium, a history of use associated with the respective portion of the storage medium, a condition characteristic associated with the respective portion of the storage medium, a read type associated with the respective portion of the storage medium, and location(s) associated with the respective portion of the storage medium.

FIG. 3A is a block diagram of a storage medium (e.g., an enterprise storage environment) divided into a plurality of logical chunks in accordance with some embodiments. FIG. 3A shows storage medium 130 comprising a plurality of flash memory devices (e.g., devices 1, 2, 3, 4, 5, 6, . . . ). In some embodiments, storage medium 130 comprises a greater or lesser number of flash memory devices. In some embodiments, each of the plurality of flash memory devices is a single die or a multi-die flash memory device. In some embodiments, storage controller 120 and storage medium 130 comprise a storage system, where storage medium 130 comprises one or more memory devices such as flash memory devices.

In some embodiments, storage controller 120 or a component thereof (e.g., logical chunk management module 212, FIG. 2A) is configured to divide the flash memory devices into a plurality of logical chunks. In FIG. 3A, for example, device 1 is divided into logical chunks 1a, 1b, 1c, 1d, 1e, 1f. Each logical chunk is assigned to a logical address (or set of logical addresses) which is mapped to a physical address (or set of physical addresses) in logical to physical mapping 220. For example, logical chunk 1a is mapped to a first range of physical addresses at device 1. In some embodiments, storage controller 120 or a component thereof (e.g., mapping module 218, FIG. 2A) is configured to maintain and update logical to physical mapping 220 as a logical chunk migrates from a first flash memory device to a second flash memory device.

In FIG. 3A, for example, storage medium 130 includes origin devices 1, 2, 3, 4 and spare devices 5, 6. For example, the origin devices are flash memory devices that initially store data, and the spare devices are reserve flash memory devices that store replicated data originating from one of the origin devices. In FIG. 3A, for example, data is stored in the logical chunks of origin devices 1-4. FIG. 3A illustrates storage medium 130 including four origin devices and two spare devices; however, as will be understood by one of skill in the art, storage medium 130 may include any number of origin and spare devices and that the devices are not necessarily all the same size.

In some embodiments, after (or while) dividing the plurality of flash memory devices into a plurality of logical chunks, storage controller 120 or a component thereof (e.g., redundancy module 214, FIG. 2A) is configured to arrange the plurality of logical chunks into redundancy sets, where each redundancy set includes one or more logical chunks. In some embodiments, each redundancy set stores redundant data sufficient to enable recovery of data stored in at least one of the one or more logical chunks. In FIG. 3A, for example, representative redundancy set 310 includes logical chunks 1a, 2a, 3a, 4a. For example, representative redundancy set 310 is redundantly encoded across the four origin devices (e.g., a contiguous RAID stripe). In FIG. 3A, for example, representative redundancy set 320 includes logical chunks 1e, 2e, 3e, 4e and is arranged with a similar organizational scheme as representative redundancy set 310.

FIG. 3B is a block diagram of a storage medium divided into a plurality of logical chunks in accordance with some embodiments. In some embodiments, after a predefined trigger condition is detected as to an origin device, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) is configured to select one of the plurality of logical chunks comprising the origin device for a migration process in accordance with predefined selection criteria. The detection of a predefined trigger condition is discussed in more detail below with respect to FIGS. 5-7, and the migration process is discussed in more detail below with respect to method 800. In some embodiments, the migration process includes replicating the selected logical chunk and storing the replicated logical chunk, comprising a copy of the selected logical chunk, at a spare device. In some embodiments, after the migration process is complete, storage controller 120 or a component thereof notifies the origin device that the selected logical chunk is now free (e.g., via a TRIM or UNMAP command for a standard SSD). In some embodiments, the replicated logical chunk is stored at the spare device in accordance with a preferred storage utilization scheme. In some embodiments, the preferred storage utilization scheme requires that the replicated logical chunk, which is assigned to a same redundancy set as the selected logical chunk, be stored in a spare device that does not include any logical chunks in the redundancy set and/or that the replicated logical chunk be stored at a location in the spare device such that the replicated logical chunk is stored in a same contiguous stripe as the other logical chunks in the redundancy set.

For example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a first predefined trigger condition in storage medium 130 corresponding to origin device 1. In FIG. 3B, for example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 1a (e.g., shown as crossed out) in representative redundancy set 310 for migration after detecting the predefined trigger condition as to origin device 1. In FIG. 3B, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 1a, comprising a copy of logical chunk 1a, at a spare device (e.g., spare device 5) that does not store any of the logical chunks in representative redundancy set 310. In FIG. 3B, for example, replicated logical chunk 1a is stored at a location in spare device 5 such that replicated logical chunk 1a is stored in a same contiguous stripe as the other logical chunks in representative redundancy set 310 (e.g., the first location (or the first range of physical addresses) at spare device 5). It should be noted that the condition triggering the migration does not have to originate within the logical chunk that is selected for migration, just within the same device.

FIG. 3C is a block diagram of a storage medium divided into a plurality of logical chunks in accordance with some embodiments. For example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a second predefined trigger condition in storage medium 130 corresponding to origin device 3. In FIG. 3C, for example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 3a (e.g., shown as crossed out) in representative redundancy set 310 for migration after detecting the predefined trigger condition as to origin device 3. In FIG. 3C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 3a, comprising a copy of logical chunk 3a, at a spare device (e.g., spare device 6) that does not store any of the logical chunks in representative redundancy set 310. In FIG. 3C, for example, replicated logical chunk 3a is stored at a location in spare device 6 such that replicated logical chunk 3a is stored in a same contiguous stripe as the other logical chunks in representative redundancy set 310 (e.g., the first location (or the first range of physical addresses) at spare device 6).

For example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a third predefined trigger condition in storage medium 130 corresponding to origin device 2. In FIG. 3C, for example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 2e (e.g., shown as crossed out) in representative redundancy set 320 for migration after detecting the predefined trigger condition as to origin device 2. In FIG. 3C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 2e, comprising a copy of logical chunk 2e, at a spare device (e.g., spare device 5) that does not store any of the logical chunks in representative redundancy set 320. In FIG. 3C, for example, replicated logical chunk 2e is stored at a location in spare device 5 such that replicated logical chunk 2e is stored in a same contiguous stripe as the other logical chunks in representative redundancy set 320 (e.g., the fifth location (or the fifth range of physical addresses) at spare device 5).

FIG. 4A is a block diagram of a storage medium (e.g., an enterprise storage environment) divided into a plurality of logical chunks in accordance with some embodiments. FIG. 4A shows storage medium 130 comprising a plurality of flash memory devices (e.g., devices 1, 2, 3, 4, 5, 6, . . . ). In some embodiments, storage medium 130 comprises a greater or lesser number of flash memory devices. In some embodiments, each of the plurality of flash memory devices is a single die or a multi-die flash memory device. In some embodiments, storage controller 120 and storage medium 130 comprise a storage system.

In some embodiments, storage controller 120 or a component thereof (e.g., logical chunk management module 212, FIG. 2A) is configured to divide the flash memory devices into a plurality of logical chunks. In FIG. 4A, for example, device 1 is divided into logical chunks 1a, 1b, 1c, 1d, 1e, 1f. Each logical chunk is assigned to a logical address (or set of logical addresses) which is mapped to a physical address (or set of physical addresses) in logical to physical mapping 220. For example, logical chunk 1a is mapped to a first location (or first range of physical addresses) at device 1. In some embodiments, management storage controller 120 or a component thereof (e.g., mapping module 218, FIG. 2A) is configured to maintain and update logical to physical mapping 220 as a logical chunk migrates from a first flash memory device to a second flash memory device.

In FIG. 4A, for example, storage medium 130 includes origin devices 1, 2, 3, 4 and spare devices 5, 6. For example, the origin devices are flash memory devices that initially store data, and the spare devices are reserve flash memory devices that store replicated data originating from one of the origin devices. In FIG. 4A, for example, data is stored in the logical chunks of origin devices 1-4. FIG. 4A illustrates storage medium 130 including four origin devices and two spare devices; however, as will be understood by one of skill in the art, storage medium 130 may include any number of origin and spare devices.

FIG. 4B is a diagram of an indirection table corresponding to the plurality of logical chunks in FIG. 4A in accordance with some embodiments. In some embodiments, after (or while) dividing the plurality of flash memory devices into a plurality of logical chunks, storage controller 120 or a component thereof (e.g., redundancy module 214, FIG. 2A) is configured to arrange the plurality of logical chunks into redundancy sets, where each redundancy set includes one or more logical chunks. In some embodiments, each redundancy set stores redundant data sufficient to enable recovery of data stored in at least one of the one or more logical chunks. Indirection table 216 contains the location (e.g., physical address) of the one or more logical chunks in each redundancy set. In some embodiments, storage controller 120 or a component thereof (e.g., redundancy module 214, FIG. 2A) is configured to maintain and update indirection table 216 as the physical addresses of the one or more logical chunks in the redundancy sets change over time (e.g., as a logical chunk migrates from a first flash memory device to a second flash memory device).

In FIG. 4B, for example, indirection table 216 illustrates that the physical address for logical chunk 1 in redundancy set 1 is located in the first location (or first range of physical addresses) at origin device 1 (e.g., indicated by coordinates 1,1), the physical address for logical chunk 2 in redundancy set 1 is located in the first location (or first range of physical addresses) at origin device 2 (e.g., indicated by coordinates 2,1), the physical address for logical chunk 3 in redundancy set 1 is located in the first location (or first range of physical addresses) at origin device 3 (e.g., indicated by coordinates 3,1), and the physical address for logical chunk 4 in redundancy set 1 is located in the first location (or first range of physical addresses) at origin device 4 (e.g., indicated by coordinates 4,1). In FIG. 4B, for example, redundancy set 1 including logical chunks 1a, 2a, 3a, 4a is redundantly encoded across the four origin devices (e.g., a contiguous RAID stripe). In FIG. 4B, for example, redundancy sets 2-6 are arranged with a similar organizational scheme as redundancy set 1. One of ordinary skill in the art will appreciate that a variety of redundancy schemes could be implemented but are not discussed here for sake of brevity.

FIG. 4C is a block diagram of a storage medium divided into a plurality of logical chunks in accordance with some embodiments. In some embodiments, after a predefined trigger condition is detected as to an origin device, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) is configured to select one of the plurality of logical chunks comprising the origin device for a migration process in accordance with predefined selection criteria. The detection of a predefined trigger condition is discussed in more detail below with respect to FIGS. 5-7, and the migration process is discussed in more detail below with respect to method 800. In some embodiments, the migration process includes replicating the selected logical chunk and storing the replicated logical chunk, comprising a copy of the selected logical chunk, at a spare device. In some embodiments, after the migration process is complete, storage controller 120 or a component thereof notifies the origin device that the selected logical chunk is now free (e.g., via a TRIM or UNMAP command for a standard SSD). It should be noted that the condition triggering the migration does not have to originate within the logical chunk that is selected for migration, just within the same device.

In some embodiments, the replicated logical chunk is stored at the spare device in accordance with a preferred storage utilization scheme. In some embodiments, the preferred storage utilization scheme requires that the replicated logical chunk be stored at a first available location in a spare device. In some embodiments, the preferred storage utilization scheme requires that the replicated logical chunk, which is assigned to a same redundancy set as the selected logical chunk, be stored at a first available location in a spare device that includes no logical chunks in the redundancy set. In some embodiments, the preferred storage utilization scheme requires that the replicated logical chunk, which is assigned to a same redundancy set as the selected logical chunk, be stored in a spare device that does not include any logical chunks in the redundancy set and that the replicated logical chunk be stored at a first available location that is not in a same contiguous stripe as the other logical chunks in the redundancy set.

For example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a first predefined trigger condition in storage medium 130 corresponding to origin device 3. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 3c (e.g., shown as crossed out) in redundancy set 3 for migration after detecting the predefined trigger condition as to origin device 3. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 3c, comprising a copy of logical chunk 3c, at spare device 5 because spare device 5 does not store any logical chunks in redundancy set 3. In this example, replicated logical chunk 3c is stored at a first available location in spare device 5 that is not in the same contiguous stripe as the other logical chunks in redundancy set 3 (e.g., in the first location (or the first range of physical addresses) at spare device 5 indicated by coordinates 5,1).

For example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a second predefined trigger condition in storage medium 130 corresponding to origin device 4. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 4b (e.g., shown as crossed out) in redundancy set 2 for migration after detecting the predefined trigger condition as to origin device 4. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 4b, comprising a copy of logical chunk 4b, at spare device 5 because spare device 5 does not store any logical chunks in redundancy set 2. In this example, replicated logical chunk 4b is optionally stored at a first available location in spare device 5 that is not in the same failure domain as the other logical chunks in redundancy set 2 (e.g., in the third location (or the third range of physical addresses) at spare device 5 indicated by coordinates 5,3).

For example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a third predefined trigger condition in storage medium 130 corresponding to origin device 1. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 1d (e.g., shown as crossed out) in redundancy set 4 for migration after detecting the predefined trigger condition as to origin device 1. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 1d, comprising a copy of logical chunk 1d, at spare device 5 because spare device 5 does not store any logical chunks in redundancy set 4. In this example, replicated logical chunk 1d is optionally stored at a first available location in spare device 5 that is not in the same contiguous stripe as the other logical chunks in redundancy set 4 (e.g., in the second location (or the second range of physical addresses) at spare device 5 indicated by coordinates 5,2).

For example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a fourth predefined trigger condition in storage medium 130 corresponding to origin device 2. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 2d (e.g., shown as crossed out) in redundancy set 4 for migration after detecting the predefined trigger condition as to origin device 2. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 2d, comprising a copy of logical chunk 2d, at spare device 6 because spare device 6 does not store any logical chunks in redundancy set 4. In this example, replicated logical chunk 2d is stored at a first available location in spare device 6 that is not in the same contiguous stripe as the other logical chunks in redundancy set 4 (e.g., in the first location (or the first range of physical addresses) at spare device 6 indicated by coordinates 6,1).

For example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a fifth predefined trigger condition in storage medium 130 corresponding to origin device 1. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 1a (e.g., shown as crossed out) in redundancy set 1 for migration after detecting the second predefined trigger condition as to origin device 1. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 1a, comprising a copy of logical chunk 1a, at spare device 5 because spare device 5 does not store any logical chunks in redundancy set 1. In this example, replicated logical chunk 1a is stored at a first available location in spare device 5 that is not in the same contiguous stripe as the other logical chunks in redundancy set 1 (e.g., in the fourth location (or the fourth range of physical addresses) at spare device 5 indicated by coordinates 5,4).

FIG. 4D is a diagram of an indirection table corresponding to the plurality of logical chunks in FIG. 4C in accordance with some embodiments. In FIG. 4D, indirection table 216 is an updated version of the indirection table illustrated in FIG. 4B. In FIG. 4D, indirection table 216 reflects the new locations (or physical addresses) of the logical chunks that were migrated as described above with respect to FIG. 4C. In FIG. 4D, for example, logical chunks 1 and 2 in redundancy set 4 have new physical addresses (e.g., indicated by coordinates 5,2 and 6,1, respectively). For example, logical chunk 1d has been migrated off of origin device 1 to the second location (or range of physical addresses) at spare device 5 (e.g., coordinates 5,2), and logical chunk 2d has been migrated off of origin device 2 to the first location (or range of physical addresses) at spare device 6 (e.g., coordinates 6,1) in accordance with the preferred storage utilization scheme. In other words, logical chunk 1 in redundancy set 4 (e.g., logical chunk 1d) has been remapped from location (1,4) to location (5,2), and logical chunk 2 in redundancy set 4 (e.g., logical chunk 2d) has been remapped from location (2,4) to location (6,1). For example, the preferred storage utilization scheme illustrated in FIGS. 4C-4D requires that the replicated logical chunk, which is assigned to a same redundancy set as the selected logical chunk, be stored in a spare device that does not include any logical chunks in the redundancy set and that the replicated logical chunk be stored at a first available location that is not in the same contiguous stripe as the other logical chunks in the redundancy set. Optionally, the replicated chunk need not be in the same contiguous stripe as the other logical chunks in the redundancy set.

FIG. 5 illustrates a flowchart representation of a method 500 of triggering a migration process in accordance with some embodiments. In some embodiments, method 500 is performed at a storage system including storage controller 120 and a plurality of flash memory devices (e.g., storage medium 130, FIG. 1) including a respective flash memory device.

At step 502, the respective flash memory device determines that a threshold number of flash memory blocks of the respective flash memory device have failed or will fail in the near future. In some embodiments, each of the plurality of flash memory devices maintains a counter indicating a number of failed flash memory blocks for the respective flash memory device. In some embodiments, storage controller 120 or a component thereof is configured to maintain a counter for each of the plurality of flash memory devices indicating a number of failed flash memory blocks for a respective flash memory device of the plurality of flash memory devices. In some embodiments, storage controller 120 or a component thereof is configured to store and maintain a collection of characterization vectors 236 for each of the plurality of flash memory devices in a characterization vector table 234. In some embodiments, a respective characterization vector 236 for a respective flash memory device includes a failed block counter field 242 indicating a number of failed flash memory blocks for the respective flash memory device. In some embodiments, a flash memory block fails when one or more codewords read from the flash memory block are uncorrectable or other ECC information produced after one or more codewords are read from the flash memory block indicates that a bit error rate corresponding to the one or more codewords exceeds a predefined threshold. In some embodiments, a flash memory block fails when a count of PE cycles for the flash memory block exceeds a predefined threshold. In some embodiments, the threshold number of failed flash memory blocks is equal to the number of flash memory blocks in a logical chunk. In some embodiments, the threshold number of failed flash memory blocks is equal to an integer multiple of the number of flash memory blocks in a logical chunk.

At step 504, the respective flash memory device reduces its advertised size. In some embodiments, the difference between the current (or reduced) advertised size and the previous advertised size is equal to the number of flash memory blocks comprising a logical chunk. In some embodiments, the advertised size of a flash memory device is an amount of bytes or addresses advertised to storage controller 120 that is equal to the amount of logical chunks that are storing data and are available for storing data. In some embodiments, the advertised size of a flash memory device is equal to the difference between the total amount of flash memory blocks comprising the flash memory device and the number of failed flash memory blocks.

At step 506, storage controller 120 directs a memory access request (e.g., a read or write operation) to the respective flash memory device. In some embodiments, storage controller 120 directs the memory access request to the respective flash memory device in response to a request from the host to perform a memory access operation at a logical address corresponding to a memory location associated with the respective flash memory device.

At step 508, the respective flash memory device returns a deferred error to storage controller 120 in response to receiving the memory access request. The deferred error indicates that a threshold number of flash memory blocks of the respective flash memory device have failed. For example, when the small computer system interface (SCSI) protocol is used by the storage system, the deferred error could be a deferred SCSI error which is only returned (or reported) to storage controller 120 upon reception of the memory access request.

At step 510, in response to receiving the deferred error, storage controller 120 queries the respective flash memory device so as to determine its current advertised size. In some embodiments, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) is configured to detect a predefined trigger condition as to the respective flash memory device in response to receiving the deferred error. Alternatively, in response to receiving the deferred error, storage controller 120 initiates a migration process (discussed in more detail below with respect to method 800) as to the respective flash memory device.

At step 512, the respective flash memory device returns the current (i.e., reduced) advertised size in response to receiving the query from storage controller 120.

At step 514, storage controller 120 determines whether the current advertised size returned by the respective flash memory device is smaller than a previous advertised size of the respective flash memory device. In some embodiments, storage controller 120 determines whether the current advertised size returned by the respective flash memory device is smaller than the amount of data stored by the respective flash memory device. For example, this indicates that at least an amount of data equal to the difference between the current advertised size and the amount of data stored by the respective flash memory device needs to be migrated to a second flash memory device different from the respective flash memory device.

At step 516, in accordance with a determination that the current advertised size of the respective flash memory device is smaller than a previous advertised size of the respective flash memory device, storage controller 120 initiates a migration process (discussed in more detail below with respect to method 800) as to the respective flash memory device.

FIG. 6 illustrates a flowchart representation of a method 600 of triggering a migration process in accordance with some embodiments. In some embodiments, method 600 is performed at a storage system including storage controller 120 and a plurality of flash memory devices (e.g., storage medium 130, FIG. 1) including a respective flash memory device.

At step 602, the respective flash memory device determines that a threshold number of flash memory blocks of the respective flash memory device have failed or may fail sometime in the near future. See discussion above with respect to step 502 FIG. 5 for examples of criteria for determining whether a respective flash memory device has failed.

At step 604, the respective flash memory device returns a notification to storage controller 120 in response to the determination in step 602. The notification indicates that a threshold number of flash memory blocks of the respective flash memory device have failed. For example, when the small computer system interface (SCSI) protocol is used by the storage system, the notification could be a proactive SCSI hardware error.

At step 606, in response to receiving the notification from the respective flash memory device, storage controller 120 initiates a migration process (discussed in more detail below with respect to method 800) as to the respective flash memory device. In some embodiments, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) is configured to detect a predefined trigger condition as to the respective flash memory device in response to receiving the error.

FIG. 7 illustrates a flowchart representation of a method 700 of triggering a migration process in accordance with some embodiments. In some embodiments, method 700 is performed at storage controller 120.

At step 702, storage controller 120 determines that a threshold number of flash memory blocks have failed or may fail sometime in the near future for a respective flash memory device of a plurality of flash memory devices. See discussion above with respect to step 502 FIG. 5 for examples of criteria for determining whether a respective flash memory device has failed.

At step 704, in response to determining that a threshold number of flash memory blocks for the respective flash memory device have failed, storage controller 120 initiates a migration process (discussed in more detail below with respect to method 800) as to the respective flash memory device. In some embodiments, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) is configured to detect a predefined trigger condition as to the respective flash memory device in response to determining that a threshold number of flash memory blocks for the respective flash memory device have failed.

FIGS. 8A-8C illustrate a flowchart representation of a method 800 of managing a storage system that comprises a storage controller and a plurality of flash memory devices each with a plurality of flash memory blocks. In some embodiments, method 800 is performed by storage controller 120 in FIG. 1, which is distinct from and coupled to storage medium 130 in FIG. 1 (e.g., comprising the plurality of flash memory devices) by one or more connections (e.g., connections 103, FIG. 1). Optional operations are indicated by dashed lines (e.g., boxes with dashed-line borders).

In some embodiments, method 800 is performed by storage controller 120 or one or more components of storage controller 120 (e.g., management module 121, FIGS. 1 and 2A). In some embodiments, method 800 is governed by instructions that are stored in a non-transitory computer readable storage medium and the instructions are executed by one or more processors of a device, such as one or more processing units (CPUs) 122 of management module 121. In some embodiments, method 800 is performed in whole or in part by computer system 110.

The storage controller divides (802) each of the plurality of flash memory devices into a plurality of logical chunks, where each logical chunk includes one or more flash memory blocks. In some embodiments, storage controller 120 or a component thereof (e.g., logical chunk management module 212, FIG. 2A) is configured to divide each of the plurality of flash memory devices into a plurality of logical chunks. Additionally, the logical address (or set of logical addresses) for each of the plurality of logical chunks are associated with a physical address (or set of physical addresses) in a logical to physical mapping 220. In some embodiments, storage controller 120 or a component thereof (e.g., mapping module 218, FIG. 2A) is configured to maintain and update logical to physical mapping 220 as logical chunks are migrated between flash memory devices.

In some embodiments, a size of the plurality of logical chunks is predetermined (804) by software. For example, an administrator of the storage system is enabled to determine the size of a logical chunk. Typically, the size of a logical chunk is greater than or equal to 1 MB.

In some embodiments, a size of the plurality of logical chunks is determined (806) based on a protocol used by the storage system. For example, when the small computer system interface (SCSI) protocol is used for the storage system, a logical chunk could be a logical unit number (LUN). The SCSI protocol supports up to 64,000 LUNs in the storage system; however, some operating systems only support up to 16,000 LUNs. For example, an 8 TB storage system could be divided into 16,000 500 MB LUNs.

The storage controller detects (808) a predefined trigger condition with respect to a respective flash memory device of the plurality of flash memory devices. In FIG. 5, for example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a predefined trigger condition as to a respective flash memory device in response to receiving a deferred trigger from the respective flash memory device. In this example, the respective flash memory device sends a deferred error to storage controller 120 after receiving a memory access request from storage controller 120. In FIG. 6, for example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a predefined trigger condition as to a respective flash memory device upon receiving a notification from the respective flash memory device. In this example, the respective flash memory device sends a proactive error to storage controller 120 after determining that a threshold number of flash memory blocks of the respective flash memory device have failed. In FIG. 7, for example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a predefined trigger condition as to a respective flash memory device after determining that a threshold number of blocks for the respective flash memory device have failed.

In some embodiments, the detected predefined trigger condition is (810) one of a set of a predefined trigger conditions. For example as stated above, the set of predefined trigger conditions includes: storage controller 120 receiving a deferred error from a respective flash memory device; storage controller 120 receiving a proactive error from a respective flash memory device; and storage controller 120 determining that a threshold number of blocks for a respective flash memory device have failed. Where the deferred or proactive errors are received by storage controller 120, each of the plurality of flash memory devices maintains a counter indicating a number of failed flash memory blocks for the respective flash memory device. Where storage controller 120 determines that a threshold number of blocks for a respective flash memory device have failed, storage controller 120 maintains a counter for each of the plurality of flash memory devices indicating a number of failed flash memory blocks for a respective flash memory device of the plurality of flash memory devices.

In some embodiments, the storage controller detects (812) the predefined trigger condition after directing a memory access request to the respective flash memory device. In FIG. 5, for example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a predefined trigger condition as to a respective flash memory device in response to receiving the deferred error and after directing a memory access request to the respective flash memory device at step 506.

In some embodiments, the predefined trigger condition indicates (814) that a counter of failed flash memory blocks for the respective flash memory device exceeds an integer multiple of a threshold number, the threshold number comprising the number of flash memory blocks included in a logical chunk or an integer multiple of the number of flash memory blocks included in a logical chunk. In FIG. 5, for example, storage controller 120 receives a deferred error from a respective flash memory device indicating that that a counter of failed flash memory blocks for the respective flash memory device exceeds an integer multiple of a threshold number. In FIG. 6, for example, storage controller 120 receives a proactive error from a respective flash memory device indicating that that a counter of failed flash memory blocks for the respective flash memory device exceeds an integer multiple of a threshold number. In FIG. 7, for example, storage controller 120 determines that a counter of failed flash memory blocks for a respective flash memory device exceeds an integer multiple of a threshold number. For example, if a logical chunk comprises 10 flash memory blocks, the threshold number is 10 or an integer multiple of 10 (e.g., 20, 30, 40, 50, etc.). For example, when the threshold number is 10, the predefined trigger condition indicates that the counter of failed flash memory blocks for the respective flash memory device exceeds 10 or an integer multiple of 10 (e.g., 20, 30, 40, 50, etc.).

In some embodiments, in response to detecting (816) the predefined trigger condition, the storage controller queries (818) the respective flash memory device to determine whether the size of the respective flash memory device is smaller than a previous size of the respective flash memory device, and the selecting and storing are performed in accordance with a determination that the query indicates that the size of the respective flash memory device is smaller than the previous size of the respective flash memory device. In FIG. 5, for example, storage controller 120 or a component thereof (e.g., trigger condition detection module 222, FIG. 2A) detects a predefined trigger condition as to the respective flash memory device upon receiving the deferred trigger from the respective memory device. In FIG. 5, for example, storage controller 120 or a component thereof queries the respective flash memory device at step 510 in response to detecting the predefined trigger condition as to the respective flash memory device. In FIG. 5, for example, shows storage controller 120 or a component thereof initiates the migration process (including the selecting and storing) at step 516 upon determining that the current advertised size of the device is smaller than the previous advertised size of the device at step 514.

In response to detecting (816) the predefined trigger condition, the storage controller selects (820) one of the plurality of logical chunks of the respective flash memory device for migration in accordance with predefined selection criteria. In FIG. 3B, for example, in response to detecting the predefined trigger condition as to origin device 1, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 1a for migration. In FIG. 4C, for example, in response to detecting the predefined trigger condition as to origin device 3, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunk 3c for migration. For example, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects logical chunks 1a and 3c pseudo-randomly or in accordance with predefined selection criteria.

In some embodiments, predefined selection criteria include (822) a least utilized logical chunk or least populated logical chunk of the respective flash memory device. For example, in response to detecting the predefined trigger condition as to a respective flash memory device, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects a least utilized (e.g., least operated on) or a least populated logical chunk of the respective flash memory device so as to reduce the time and resources needed for the migration process.

In some embodiments, predefined selection criteria include (824) the logical chunk associated with a memory access request. For example, in response to detecting the predefined trigger condition as to a respective flash memory device, storage controller 120 or a component thereof (e.g., selection module 226, FIG. 2A) selects the logical chunk associated with a current or next memory access request (e.g., a read or write operation).

In some embodiments, predefined selection criteria include a logical chunk that is simple or efficient for storage controller 120 to fetch at that time. For example, while the storage controller 120 is doing other tasks unrelated to method 800 (e.g., garbage collection or error scrubbing) on a logical chunk said logical chunk is selected prior to or after completion of the unrelated task.

In response to detecting (816) the predefined trigger condition, the storage controller stores (826) a replicated logical chunk, comprising a copy of the selected logical chunk, at a second flash memory device different from the respective flash memory device. In FIG. 3B, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 1a, comprising a copy of logical chunk 1a, at spare device 5, where spare device 5 is different from origin device 1. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 3c, comprising a copy of logical chunk 3c, at spare device 5, where spare device 5 is different from origin device 3. In some embodiments, the selected chunk is stored in a different type of memory media than it was previously stored. For example, the selected logical chunk is migrated from flash memory to HDD or vice versa.

In some embodiments, storage controller 120 or a component thereof (e.g., migration module 224, FIG. 2A) performs a migration process including the selecting (820), the storing (826), and the remapping (832). In some embodiments, migration of a selected logical chunk includes the storing (826) and the remapping (832). In some embodiments, after the migration process is complete, storage controller 120 or a component thereof notifies the origin device that the selected logical chunk is now free (e.g., via a TRIM or UNMAP command for a standard SSD).

In some embodiments, the second flash memory device is (828) in a different failure domain than the respective flash memory device. In some embodiments, storage medium 130 comprises an enterprise storage environment. The enterprise storage environment is organized into a hierarchy including a plurality of rows, a plurality of cabinets per row, a plurality of shelves per cabinet, and a plurality of flash memory devices per shelf. In some embodiments, each of the levels of the hierarchy (i.e., row, cabinet, shelf, flash memory device) is considered a failure domain. In some embodiments, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores the replicated logical chunk in a different failure domain than the one including the respective flash memory device. In some embodiments, at least a predefined number of failure domains must be crossed when storing the replicated logical chunk. For example, if the respective flash memory device is located in row 1, cabinet 2, shelf 3 and the replicated logical chunk must cross one failure domain, the replicated flash memory device is at least stored in different shelf in row 1, cabinet 2.

In some embodiments, in response to detecting (816) the predefined trigger condition, the storage controller re-encodes (830) data in at least one logical chunk of the respective flash memory device with a higher level of error correction protection than a prior encoding of the data in the at least one logical chunk of the respective flash memory device. In some embodiments, storage controller 120 or a component thereof (e.g., re-encoding module 230, FIG. 2A) is configured to re-encode the data in one of the plurality of logical chunks of the respective flash memory device after the predefined trigger condition as to the respective flash memory device is detected. As one example, more parity bits are included (i.e., the parity-to-data ratio is increased) for the respective logical chunk. As another example, a stronger ECC scheme is used for the respective logical chunk. For example, the data stored in the respective logical chunk is re-encoded from Bose-Chaudhuri-Hocquenghem (BCH) encoding to low-density parity check (LDPC) encoding.

In response to detecting (816) the predefined trigger condition, the storage controller remaps (832) an address of the selected logical chunk to a physical location of the replicated logical chunk. In some embodiments, storage controller 120 or a component thereof (e.g., mapping module 218, FIG. 2A) is configured to update logical to physical mapping 220 so that the physical address of the selected logical chunk (e.g., a location at the respective flash memory device) is replaced by the physical address of the replicated logical chunk (e.g., a location at a second device different from the respective flash memory device). In other words, the logical address (or set of logical addresses) associated with the replicated logical chunk is the same as the logical address (or set of logical addresses) associated with selected logical chunk, but the physical address (or set of physical addresses) associated with the selected logical chunk is replaced by the physical address (or set of physical addresses) associated with the replicated logical chunk. In FIG. 3C, for example, after storing replicated logical chunk 2e, comprising a copy of logical chunk 2e, at spare device 5, mapping module 218 remaps the physical address associated with logical chunk 2e from the fifth location (or the fifth range of physical address) at origin device 2 to the fifth location (or the fifth range of physical address) at spare device 5 in logical to physical mapping 220.

The storage controller decreases (834) a number of logical chunks associated with the respective flash memory device. In some embodiments, storage controller 120 or a component thereof (e.g., logical chunk management module 212, FIG. 2A) is configured to decrease a number of logical chunks associated with the respective flash memory device after migrating a selected logical chunk from the respective flash memory device to a second flash memory device different from the respective flash memory device. In FIG. 3B, for example, after detecting a predefined trigger condition as to origin device 1 and migrating logical chunk 1a to spare device 5, logical chunk management module 212 decreases the number of logical chunks associated with origin device 1 from six to five (e.g., indicated by crossing out logical chunk 1a).

In some embodiments, the logical chunks are allocated (836) for storing data and are organized into a plurality of redundancy sets, each redundancy set comprising one or more logical chunks and storing redundant data sufficient to enable recovery of data stored in at least one of the one or more logical chunks. For example, data includes programs, instructions, ECC, metadata, user data, system data, and/or operator data. After (or while) dividing the plurality of flash memory devices into a plurality of logical chunks, storage controller 120 or a component thereof (e.g., redundancy module 214, FIG. 2A) is configured to arrange the plurality of logical chunks into redundancy sets, where each redundancy set includes one or more logical chunks. In some embodiments, each redundancy set stores redundant data sufficient to enable recovery of data stored in at least one of the one or more logical chunks. In FIG. 3A, for example, representative redundancy set 310 (including logical chunks 1a, 2a, 3a, 4a) is redundantly encoded across the four origin devices (e.g., a contiguous RAID stripe). Similarly, in FIG. 3A, representative redundancy set 320 (including logical chunks 1e, 2e, 3e, 4e) is redundantly encoded across the four origin devices (e.g., a contiguous RAID stripe). In FIGS. 4A-4B, for example, redundancy set 1 (including logical chunks 1a, 2a, 3a, 4a) is redundantly encoded across the four origin devices (e.g., a contiguous RAID stripe).

In some embodiments, the replicated logical chunk is included (838) in a respective redundancy set of the plurality of redundancy sets that formerly included the selected logical chunk. In some embodiments, the replicated chunk is included in the same contiguous stripe as the selected chunk. In FIG. 3B, for example, replicated logical chunk 1a is included in representative redundancy set 310, which formerly included logical chunk 1a. In some embodiments, the replicated chunk is included in the same redundancy set via an indirection table. In FIGS. 4C-4D, for example, replicated logical chunk 4b (e.g., corresponding to coordinates 5,3) is included in redundancy set 2, which formerly included logical chunk 4b.

In some embodiments, a respective redundancy set of the plurality of redundancy sets is (840) a contiguous stripe across the plurality of flash memory devices, and the replicated logical chunk is stored in a same contiguous stripe as the selected logical chunk at the second flash memory device different from the respective flash memory device. In some embodiments, the replicated logical chunk is assigned to the same redundancy set as the selected logical chunk. In some embodiments, the replicated logical chunk is stored in a spare device that does not include other logical chunks in the redundancy set, and the replicated logical chunk is stored such that it is in the same contiguous stripe as the other logical chunks in the redundancy set. In FIG. 3A, for example, representative redundancy set 310 (including logical chunks 1a, 2a, 3a, 4a) is redundantly encoded across the four origin devices to form a contiguous stripe. In FIG. 3B, for example, replicated logical chunk 1a, comprising a copy of logical chunk 1a, is stored at the first location (or first range of physical addresses) in spare device 5 such that it is in the contiguous stripe with the other logical chunks in representative redundancy set 310 (e.g., logical chunks 2a, 3a, 4a).

In some embodiments, the replicated logical chunk is stored (842) in accordance with a preferred storage utilization scheme, and the storage controller associates the replicated logical chunk with a respective redundancy set of the plurality of redundancy sets in an indirection table. For example, the preferred storage utilization scheme illustrated in FIGS. 4C-4D requires that the replicated logical chunk, which is assigned to a same redundancy set as the selected logical chunk, be stored in a spare device that does not include any logical chunks in the redundancy set and that the replicated logical chunk be stored at a first available location that, optionally, is not in the same contiguous stripe as the other logical chunks in the redundancy set. In FIG. 4C, for example, storage controller 120 or a component thereof (e.g., storing module 228, FIG. 2A) stores replicated logical chunk 4b, comprising a copy of logical chunk 4b, at spare device 5 because spare device 5 does not store any logical chunks in redundancy set 2. In this example, replicated logical chunk 4b is stored at a first available location in spare device 5 that is not in the same contiguous stripe as the other logical chunks in redundancy set 2 (e.g., in the third location or the third range of physical addresses at spare device 5). In FIG. 4D, for example, storage controller 120 or a component thereof (e.g., redundancy module 214) updates indirection table 216 so that that logical chunk 4 in redundancy set 2 (e.g., logical chunk 4b) is remapped from location (4,2) to location (5,3).

It will be understood that, although the terms “first,” “second,” etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first flash memory device could be termed a second flash memory device, and, similarly, a second flash memory device could be termed a first flash memory device, which changing the meaning of the description, so long as all occurrences of the “first flash memory device” are renamed consistently and all occurrences of the “second flash memory device” are renamed consistently. The first flash memory device and the second flash memory device are both flash memory devices, but they are not the same flash memory device.

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the claims. As used in the description of the embodiments and the appended claims, the singular forms “a,” “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term “and/or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

As used herein, the term “if” may be construed to mean “when” or “upon” or “in response to determining” or “in accordance with a determination” or “in response to detecting,” that a stated condition precedent is true, depending on the context. Similarly, the phrase “if it is determined [that a stated condition precedent is true]” or “if [a stated condition precedent is true]” or “when [a stated condition precedent is true]” may be construed to mean “upon determining” or “in response to determining” or “in accordance with a determination” or “upon detecting” or “in response to detecting” that the stated condition precedent is true, depending on the context.

The foregoing description, for purpose of explanation, has been described with reference to specific embodiments. However, the illustrative discussions above are not intended to be exhaustive or to limit the claims to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The embodiments were chosen and described in order to best explain principles of operation and practical applications, to thereby enable others skilled in the art. 

What is claimed is:
 1. A method of managing a storage system that comprises a storage controller and a plurality of flash memory devices, each with a plurality of flash memory blocks, the method comprising: at the storage controller: dividing each of the plurality of flash memory devices into a plurality of logical chunks, wherein each logical chunk includes one or more flash memory blocks; detecting a predefined trigger condition with respect to a respective flash memory device of the plurality of flash memory devices; in response to detecting the predefined trigger condition: selecting one of the plurality of logical chunks of the respective flash memory device for migration in accordance with predefined selection criteria; storing a replicated logical chunk, comprising a copy of the selected logical chunk, at a second flash memory device different from the respective flash memory device; and remapping an address of the selected logical chunk to a physical location of the replicated logical chunk; and decreasing a number of logical chunks associated with the respective flash memory device.
 2. The method of claim 1, wherein the second flash memory device is in a different failure domain than the respective flash memory device.
 3. The method of claim 1, wherein the detected predefined trigger condition is one of a set of a predefined trigger conditions.
 4. The method of claim 1, wherein the storage controller detects the predefined trigger condition after directing a memory access request to the respective flash memory device.
 5. The method of claim 1, further comprising in response to detecting the predefined trigger condition, querying the respective flash memory device to determine whether the size of the respective flash memory device is smaller than a previous size of the respective flash memory device; and wherein the selecting and storing are performed in accordance with a determination that the query indicates that the size of the respective flash memory device is smaller than the previous size of the respective flash memory device.
 6. The method of claim 1, wherein the predefined trigger condition indicates that a counter of failed flash memory blocks for the respective flash memory device exceeds an integer multiple of a threshold number, the threshold number comprising the number of flash memory blocks included in a logical chunk or an integer multiple of the number of flash memory blocks included in a logical chunk.
 7. The method of claim 1, wherein the logical chunks are allocated for storing data and are organized into a plurality of redundancy sets, each redundancy set comprising one or more logical chunks and storing redundant data sufficient to enable recovery of data stored in at least one of the one or more logical chunks.
 8. The method of claim 7, wherein the replicated logical chunk is included in a respective redundancy set of the plurality of redundancy sets that formerly included the selected logical chunk.
 9. The method of claim 7, wherein a respective redundancy set of the plurality of redundancy sets is a contiguous stripe across the plurality of flash memory devices, and wherein the replicated logical chunk is stored in a same contiguous stripe as the selected logical chunk at the second flash memory device different from the respective flash memory device.
 10. The method of claim 7, wherein the replicated logical chunk is stored in accordance with a preferred storage utilization scheme, the method including, associating the replicated logical chunk with a respective redundancy set of the plurality of redundancy sets in an indirection table.
 11. The method of claim 1, wherein the predefined selection criteria include a least utilized logical chunk or least populated logical chunk of the respective flash memory device.
 12. The method of claim 1, wherein the predefined selection criteria include the logical chunk associated with a memory access request.
 13. The method of claim 1, wherein a size of the plurality of logical chunks is predetermined by software.
 14. The method of claim 1, wherein a size of the plurality of logical chunks is determined based on a protocol used by the storage system.
 15. The method of claim 1, further comprising: in response to detecting the predefined trigger condition with respect to the respective flash memory device, re-encoding data in at least one logical chunk of the respective flash memory device with a higher level of error correction protection than a prior encoding of the data in the at least one logical chunk of the respective flash memory device.
 16. A storage controller, comprising: one or more processors; a host interface configured to couple the storage controller to a host; a storage medium interface configured to couple the storage controller to a storage medium including a plurality of flash memory devices, each with a plurality of flash memory blocks; and a storage controller memory storing instructions, which, when executed by the one or more processors, causes the storage controller to perform operations comprising: dividing each of the plurality of flash memory devices into a plurality of logical chunks, wherein each logical chunk includes one or more flash memory blocks; detecting a predefined trigger condition with respect to a respective flash memory device of the plurality of flash memory devices; in response to detecting the predefined trigger condition: selecting one of the plurality of logical chunks of the respective flash memory device for migration in accordance with predefined selection criteria; and storing a replicated logical chunk, comprising a copy of the selected logical chunk, at a second flash memory device different from the respective flash memory device; and remapping an address of the selected logical chunk to a physical location of the replicated logical chunk; and decreasing a number of logical chunks associated with the respective flash memory device.
 17. The storage controller of claim 16, wherein the logical chunks are allocated for storing data and are organized into a plurality of redundancy sets, each redundancy set comprising one or more logical chunks and storing redundant data sufficient to enable recovery of data stored in at least one of the one or more logical chunks.
 18. The storage controller of claim 17, wherein the replicated logical chunk is included in a respective redundancy set of the plurality of redundancy sets that formerly included the selected logical chunk.
 19. The storage controller of claim 17, wherein a respective redundancy set of the plurality of redundancy sets is a contiguous stripe across the plurality of flash memory devices, and wherein the replicated logical chunk is stored in a same contiguous stripe as the selected logical chunk at the second flash memory device different from the respective flash memory device.
 20. The storage controller of claim 17, wherein the replicated logical chunk is stored in accordance with a preferred storage utilization scheme, the method including, associating the replicated logical chunk with a respective redundancy set of the plurality of redundancy sets in an indirection table.
 21. A non-transitory computer readable storage medium, storing one or more programs for execution by one or more processors of a storage controller coupled to a storage medium including a plurality of flash memory devices, wherein each flash memory device includes a plurality of flash memory blocks, the one or more programs including instructions that when executed by the one or more processors cause the storage controller to: divide each of the plurality of flash memory devices into a plurality of logical chunks, wherein each logical chunk includes one or more flash memory blocks; detect a predefined trigger condition with respect to a respective flash memory device of the plurality of flash memory devices; in response to detecting the predefined trigger condition: select one of the plurality of logical chunks of the respective flash memory device for migration in accordance with predefined selection criteria; and store a replicated logical chunk, comprising a copy of the selected logical chunk, at a second flash memory device different from the respective flash memory device; and remap an address of the selected logical chunk to a physical location of the replicated logical chunk; and decrease a number of logical chunks associated with the respective flash memory device.
 22. The non-transitory computer readable storage medium of claim 21, wherein the logical chunks are allocated for storing data and are organized into a plurality of redundancy sets, each redundancy set comprising one or more logical chunks and storing redundant data sufficient to enable recovery of data stored in at least one of the one or more logical chunks.
 23. The non-transitory computer readable storage medium of claim 22, wherein the replicated logical chunk is included in a respective redundancy set of the plurality of redundancy sets that formerly included the selected logical chunk.
 24. The non-transitory computer readable storage medium of claim 22, wherein a respective redundancy set of the plurality of redundancy sets is a contiguous stripe across the plurality of flash memory devices, and wherein the replicated logical chunk is stored in a same contiguous stripe as the selected logical chunk at the second flash memory device different from the respective flash memory device.
 25. The non-transitory computer readable storage medium of claim 22, wherein the replicated logical chunk is stored in accordance with a preferred storage utilization scheme, the method including, associating the replicated logical chunk with a respective redundancy set of the plurality of redundancy sets in an indirection table. 